package wwy.Controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import wwy.Common.LogicController;
import wwy.Dao.MerchantDao;
import wwy.Dto.MerchantDto;
import wwy.Service.MerchantService;
import wwy.entity.Merchant;

import java.util.List;

@RestController
@Tag(name = "商家")
@RequestMapping("/merchant")
@RefreshScope
public class MerchantController extends LogicController<MerchantService, MerchantDao, Merchant, Long> {
    public MerchantController(MerchantService service){super(service);}

    @GetMapping("/getMerchantByName/{merchantName}")
    @Operation(summary = "根据商家名获取商家信息")
    public MerchantDto getMerchantByName(@PathVariable("merchantName") String merchantName){
        return service.getMerchantByName(merchantName);
    }
    @GetMapping("/getAllMerchants")
    @Operation(summary = "获取所有商家信息")
    public List<MerchantDto> getAllMerchants(){
        return service.getAllMerchants();
    }
}
